UPSTREAM: wifi: ath12k: Address issues during beacon stats retrieval#162
Merged
sgaud-quic merged 2 commits intoqualcomm-linux:qcom-6.18.yfrom Jan 23, 2026
Merged
UPSTREAM: wifi: ath12k: Address issues during beacon stats retrieval#162sgaud-quic merged 2 commits intoqualcomm-linux:qcom-6.18.yfrom
sgaud-quic merged 2 commits intoqualcomm-linux:qcom-6.18.yfrom
Conversation
added 2 commits
January 8, 2026 17:07
Currently, ath12k_fw_stats_reset() is called in ath12k_mac_get_fw_stats() before fetching the required stats from the firmware. However, ath12k_open_bcn_stats() requests firmware stats for each enabled BSS individually. Since the firmware stats are reset before fetching, only the last BSS's data is displayed. Also, in ath12k_mac_op_get_txpower(), ath12k_mac_op_sta_statistics(), and ath12k_mac_op_link_sta_statistics(), after getting the stats from the firmware, the reset function is not called until the next firmware stats are requested or while unloading the module. Hence, the stats buffer will not be freed until one of the above sequences is executed. However, in ath12k_open_vdev_stats(), ath12k_open_bcn_stats() and ath12k_open_pdev_stats(), firmware stats are reset after copying the necessary data in ath12k_wmi_fw_stats_dump(). This leads to inconsistent usage of ath12k_fw_stats_reset() for freeing the firmware stats. Avoid these discrepancies by making it the caller's responsibility to free the stats buffer, thereby removing the need to free the stats buffer in ath12k_mac_get_fw_stats() and ath12k_wmi_fw_stats_dump(). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Manish Dharanenthiran <manish.dharanenthiran@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Signed-off-by: Qian Zhang <qian.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/all/20251031-beacon_stats-v1-1-f52fce7b03ac@qti.qualcomm.com/
Currently, for beacon_stats, ath12k_mac_get_fw_stats() is called for each started BSS on the specified hardware. ath12k_mac_get_fw_stats() will wait for the fw_stats_done completion after fetching the requested data from firmware. For the beacon_stats, fw_stats_done completion will be set only when stats are received for all BSSes. However, for other stats like vdev_stats or pdev_stats, there is one request to the firmware for all enabled BSSes. Since beacon_stats is fetched individually for all BSSes enabled in that pdev, waiting for the completion event results in a timeout error when multiple BSSes are enabled. Avoid this by completing the fw_stats_done immediately after updating the requested BSS's beacon stats in the list. Subsequently, this list will be used to display the beacon stats for all enabled BSSes in the requested pdev. Additionally, remove 'num_bcn_recvd' from the ath12k_fw_stats struct as it is no longer needed. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Fixes: 9fe4669 ("wifi: ath12k: Request beacon stats from firmware") Signed-off-by: Manish Dharanenthiran <manish.dharanenthiran@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Signed-off-by: Qian Zhang <qian.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/all/20251031-beacon_stats-v1-2-f52fce7b03ac@qti.qualcomm.com/
shashim-quic
approved these changes
Jan 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, retrieving beacon stats is getting failed with timed out error
when multiple BSSes are enabled. This patch series tries to address the
mentioned issue by the following,
#1: Reset the firmware stats only after retrieving the complete stats
#2: Remove the wait timeout to get stats for all enabled BSSes during
beacon stats retrieval.
Manish Dharanenthiran (2):
wifi: ath12k: Make firmware stats reset caller-driven
wifi: ath12k: Fix timeout error during beacon stats retrieval
drivers/net/wireless/ath/ath12k/core.c | 2 --
drivers/net/wireless/ath/ath12k/core.h | 1 -
drivers/net/wireless/ath/ath12k/debugfs.c | 9 +++------
drivers/net/wireless/ath/ath12k/mac.c | 15 ++++++++++-----
drivers/net/wireless/ath/ath12k/wmi.c | 12 +-----------
5 files changed, 14 insertions(+), 25 deletions(-)
https://lore.kernel.org/all/20251031-beacon_stats-v1-0-f52fce7b03ac@qti.qualcomm.com/
CRs-Fixed: 4398576